<script type="text/javascript">
function showBankFileList(json){
	if(json.statusCode==DWZ.statusCode.error){
		navTabAjaxDone(json)
	}else{
		var content="";
		var numPerPage=json.numPerPage;
		var currentPage=json.currentPage;
		var totalCount=json.totalCount;
		var pageCount=json.pageCount
		var list=json.list;
		if(list.length==0){
			content+="<tr><td colspan='2' align='center' >未查询到数据</td></tr>"
		}else{
			for(var i=0;i<list.length;i++){
				if(i==0){
					$("input[name='bank']").val(list[i].bank);
					$("input[name='FileType']").val(list[i].fileType); 
				}
				var value=(list[i].fileName).substring(0,(list[i].fileName).indexOf("."));
				content+="<tr onmouseover='moveoverMouse(this)' onmouseout='moveoutMouse(this)' align='center'><td width='2%'><input name='fileNames' onclick='test(this)' value="+value+" type='checkbox'></td><td width='98%'>"+
				value+"</td></tr>"
			}	
		}
		$("#tbodyByBankFile").html(content);
		$("input[name='numPerPage']").val(numPerPage);
		$("input[name='pageNum']").val(currentPage); 
		$("#totalCountByBankFile").text("条,共"+totalCount+"条");
		$("#paginationByBankFile").addClass("pagination").attr("targetType","navTab").attr("totalCount",totalCount).attr("numPerPage",numPerPage).attr("pageNumShown","10").attr("currentPage",currentPage).attr("rel","tbodyByBankFile").attr("callback","showBankFileList");
		$("div.pagination").each(function(){
			var $this = $(this);
			$this.pagination({
				targetType:"navTab",
				rel:"tbodyByBankFile",
				totalCount:totalCount,
				numPerPage:numPerPage,
				pageNumShown:10,
				currentPage:currentPage,
				callback:showBankFileList
			});
		});
	}
	

}

function checkNum(){
	if($("input[name='fileNames']:checked").length < 1){
		 alertMsg.warn("您未选择数据！")
		 return false;
	 }
}

function importBankFile(json){
	if(json.statusCode==DWZ.statusCode.ok){
		alertMsg.correct("文件导入成功")
		var FileType,bank;
		FileType=$("input[name='FileType']").val();
		bank=$("input[name='bank']").val()
		//alert(FileType+";;;"+bank)
		$.ajax({
			type: 'POST',
			url:"fileEntering/showBankFileList",
			dataType:"json",
			data:{FileType:FileType,bank:bank},
			cache: false,
			success: showBankFileList,//回调函数
			error: DWZ.ajaxError
		})
	}else{
		 alertMsg.warn(json.message);
	}
}
function removeCnuOnFileType(s){
	var $this=$(s)
	if($this.val()=="CNU"){
		$("select[name='bank'] option").each(function(){
			if($(this).val() == "JS_BANK"){
			    $(this).remove();
			   }
		})
	}else{
		var f=true;
		$("select[name='bank'] option").each(function(){
			if($(this).val() == "JS_BANK"){
			    f=false;
			   }
		})
		if(f){
			$("select[name='bank']").append("<option value='JS_BANK'>建设银行</option>");
		}
	}
}
function removeCnuOnBank(s){	
	var $this=$(s)
	if($this.val()=="JS_BANK"){
		$("select[name='FileType'] option").each(function(){
			if($(this).val() == "CNU"){
			    $(this).remove();
			   }
		})
	}else if($this.val()=="WF_BANK"){
		var f=true;
		$("select[name='FileType'] option").each(function(){
			if($(this).val() == "CNU"){
			    f=false;
			   }
		})
		if(f){
			$("select[name='FileType']").append("<option value='CNU'>联名卡制卡申请</option>");
		}
	}
}
</script>

<div class="pageHeader ">
	<form id="pagerForm" method="post" action="fileEntering/showBankFileList" class="pageForm required-validate" onsubmit="return validateCallback(this,showBankFileList);">
		<input type="hidden" name="pageNum" value="" /> 
		<input type="hidden" name="numPerPage" value="" />
		<!-- <input type="hidden" name="pageCount" value="" /> -->
		<div class="searchBar" >
		<div class="row" style="padding: 0 10px;">
		<div class="col-md-6 col-sm-12" >
			<p>
				<label>文件选择：</label>
				<select name="FileType"  ">
					<option value="CNU">联名卡制卡申请</option>
					<option value="SQ">联名卡制卡任务返回</option>
					<option value="GHX">联名卡挂失注销解挂</option>
					<option value="SCX">联名卡补换卡</option>
					<option value="BS">联名卡开卡</option>
				</select>
			</p>
			</div>
		<div class="col-md-6 col-sm-12" >
			<p>
				<label>文件来源：</label>
				<select name="bank" class="required" ">
					<option value="WF_BANK">潍坊银行</option>
					<option value="JS_BANK">建设银行</option>
				</select>
			</P>
		</div>
		</div>
		<div class="subBar">
			<ul> 
				<li>
				<div class="buttonActive" ><div class="buttonContent" ><button type="submit">查询</button></div></div>
				</li>
			</ul>
		</div>
		</div>
	</form>	
</div>

<form method="post" action="fileEntering/importBankFile" class="pageForm required-validate" onsubmit="return validateCallback(this,importBankFile);">
	<div class="pageContent">
	<div class="panelBar">
		<ul class="toolBar">
			<li><a class="add" href="fileEntering/goGenerateCardNumber" target="dialog" rel="generateCardNumber" title="生成卡号" width="430" height="220"><span>生成卡号</span></a></li>
			<li><a class="add" href="fileEntering/goGenerateCardNoDetail" target="dialog" rel="generateCardNumber" title="卡号详情" width="800" height="500"><span>卡号详情</span></a></li>
		</ul>
	</div>
	<input type="hidden" name="FileType" value="" />
	<input type="hidden" name="bank" value="" />
		<table class="table" width="100%" layoutH="258">
			<thead>
				<tr align="center">
					<th width="2%"><input type="checkbox" onclick="checkAllCss(this)" name="" group="fileNames" class="checkboxCtrl"></th>
					<th width="98%" >文件名称</th>
				</tr>
			</thead>
			<tbody id="tbodyByBankFile">
				
			</tbody>
		</table>
	<!-- <div class="panelBar">
		<div class="pages">
			<span>显示</span>
			<select id="numPerPageByBankFile" name="numPerPage" onchange="paging(this,$('#showBankFileList'),showBankFileList)">
				<option value="20">20</option>
				<option value="30">30</option>
				<option value="50">50</option>
				<option value="100">100</option>
			</select>
			<span id="totalCountByBankFile" ></span>
		</div>
			<div id="paginationByBankFile" class="pagination1"  ></div>
	</div> -->
	<div class="panelBar">
		<div class="pages">
			<span>显示</span>
			<select class="combox" name="numPerPage" onchange="navTabPageBreakCommon({numPerPage:this.value},'tbodyByBankFile',showBankFileList)">
				<option value="20">20</option>
				<option value="50">50</option>
				<option value="100">100</option>
				<option value="200">200</option>
			</select>
			<span id="totalCountByBankFile">条，共0条</span>
		</div>

		<div callback='showBankFileList' id="paginationByBankFile" rel="tbodyByBankFile" class="pagination" targetType="navTab" totalCount="0" numPerPage="5" pageNumShown="5" currentPage="0"></div>

	</div>
	 <div class="formBar">
		<ul> 
			<li>
				<div class="buttonActive" >
					<div class="buttonContent" ><button type="submit" onclick="return checkNum();">导入</button></div>	
				</div>
				<span style="padding-left: 20px"></span>
			</li>
		</ul>
	</div> 
			
</div>
	</form>
	

